package main

import "fmt"

func If(condition bool, trueVal, falseVal interface{}) interface{} {
	if condition {
		return trueVal
	}
	return falseVal
}

func max(num1, num2 int) int {
	return If(num1 > num2, num1, num2).(int)
}

func swap(x, y string) (string, string) {
	return y, x
}

func main() {
	/* 定义局部变量 */
	a := 100
	b := 200
	var ret int

	/* 调用函数并返回最大值 */
	ret = max(a, b)

	fmt.Printf("最大值是 : %d\n", ret)
	c, d := swap("john", "peat")
	fmt.Printf("%s,%s", c, d)
}
